<style type="text/css">
	.delete_input_head {
		cursor: pointer;
	}
	.order_unit {
		border: 1px solid #ddd;
		width: 40px;
		height: 15px;
		line-height: 15px;
		text-align: center;	
	}
	.save_img {
		width: 13px;
		height: 13px;
		border: none;
	}
</style>

<!-- js validate form  -->
<script type="text/javascript">
function submitform()
{
  document.myform.submit();
}
</script>
<!-- js ajax -->
<script type="text/JavaScript">
	$(document).ready(function(){
		$('.delete_input_head').click(function(){
			var val = [];
		    $(':checkbox:checked').each(function(i){
		      val[i] = $(this).val();
		    }); 	    
			$.post(		
				'<?php echo base_url(); ?>back_end/unit/load',
				{
				    value_all: val
				},
				function (data)
				{
					$('#load').html(data);
				}
					
			);
		});
	});
</script>

<div class="content_head">
	<?php echo $title; ?>
</div>	
<div class="content_ct">
	<div class="content_ct_search">
		<table class="content_ct_search_tbl"  width="100%">
			<form method="POST" action="<?php echo base_url() ?>back_end/unit/search">    
				<tr>
					<td width="10%">
						<span>Tên đơn vị tính:</span>
					</td>
					<td width="10%">
						<input  class="content_ct_search_tbltxt" name="nameSearch" value="<?php if(isset($_SESSION['like_unit'])){ echo $_SESSION['like_unit']['name']; } ?>" type="text" />
					</td>
					<td width="40%"></td>
					<td width="40%"></td>
				</tr>		
				<tr>
					<td></td>
					<td>
						<input id="input_checkbox_2" style="cursor:pointer;" type="submit" name="formSearch" value="Tìm kiếm" />
						<input style="cursor:pointer;" type="reset" value="Reset" />
					</td>
					<td></td>
					<td></td>
				</tr>
			</form>
		</table>
		
	</div>
	<!-- end content_ct_search -->
		<form name="myform" id="frmForm" method="POST" action="<?php echo base_url()?>back_end/unit/order" >
	
	<div class="content_ct_show">	
		<div class="content_ct_show_abs">
			<?php echo $this->session->flashdata('msview'); ?>
		</div>
		<div class="content_ct_show_paging">
			&nbsp;
		</div>		
		<div class="content_ct_show_head">
			<input class="delete_input_head" type="button" value="Xóa" />
			<a class="add_new" href="<?php echo base_url()?>back_end/unit/add">Thêm mới</a>
			<span style="padding-left: 5px; color: #FF9933;" class="count_check"></span>
		</div>
		
	<div id="load">	
			<div class="content_ct_show_ct">
				<table class="content_ct_show_ct_tbl" width="100%">   
					<tr class="content_ct_show_ct_tbl_top">
						<td width="5%">
							<input type="checkbox" class="input_checkall" />
						</td>
						<td width="5%">
	                    	<a class="link_change" href="<?php echo base_url() ?>back_end/unit/sort/id/<?php echo $sort; ?>">ID</a>
						</td>
						<td width=80%">
							<a class="link_change" href="<?php echo base_url() ?>back_end/unit/sort/name/<?php echo $sort; ?>">Đơn vị tính</a>
						</td>
						<td width="5%">
							<a class="link_change" href="<?php echo base_url() ?>back_end/unit/sort/status/<?php echo $sort; ?>">Trạng thái</a>
						</td>
						<td width="5%">
							<span>Action</span>
						</td>
					</tr>
					
					<?php
	                	$count = 1; 
	                	if (count($unit_value) > 0) {
	                		foreach ($unit_value as $value) {
	                		$count += 1;	 
	                ?> 
					<tr class="<?php if ($count%2) { echo 'content_ct_show_ct_tbl_bt_1'; } else { echo 'content_ct_show_ct_tbl_bt_2'; }  ?>">
						<td>
							<input class="input_checkbox" type="checkbox"  value="<?php echo $value['id']; ?>" name="value_id[]"/>
						</td>
						<td>
							<span><?php echo $value['id']; ?></span>
						</td>
						<td>
							<span><?php echo $value['name']; ?></span>
						</td>
						<td>
							<?php if($value['status'] == 1) { ?>
	                    		<a class="tag_action" href="<?php echo base_url()?>back_end/admins/active/<?php echo $table.'-'.$value['id'].'-'.'0'.'-'.$table; ?>"><img src="<?php echo base_url()?>images/back_end/icon/check2.png" title="Trạng thái" alt="icon check" /></a>
	                    	<?php } else { ?>
	                 			<a class="tag_action" href="<?php echo base_url()?>back_end/admins/active/<?php echo $table.'-'.$value['id'].'-'.'1'.'-'.$table; ?>"><img src="<?php echo base_url()?>images/back_end/icon/check.png" title="Trạng thái" alt="icon check" /></a>
	                    	<?php }?>
						</td>
						<td>
							<a href="<?php echo base_url()?>back_end/unit/edit/<?php  echo $value['id']; ?>">Sửa</a>
							<span>|</span>
							<a href="<?php echo base_url()?>back_end/unit/delete/<?php  echo $value['id']; ?>">Xóa</a>
						</td>
					</tr>
					<?php }
					 	} else {
					?>
					<tr>
						<td colspan="5"><i style="color: #000;">Không có kết quả nào được tìm thấy</i></td>
					</tr> 
					 <?php
					 	} 
					 ?>
				</table>
			</div>
			
			<div class="content_ct_show_paging">
				<span style="color: #888;">Tổng số:</span>
				<span style="color: #444;">(<?php echo $this->pagination->total_rows; ?>)</span>
				<?php echo $this->pagination->create_links(); ?>
			</div>			
		</div>
	</div>	
	</form>
	<!-- end content_ct_show -->
</div>

